package com.adou.d10;

public class LambdaTest1 {
    public static void main(String[] args) {

        //
        Animal a = new Animal() {
            @Override
            public void run() {
                System.out.println("狗跑的真快！！！");
            }
        };
        a.run();

        // 只能简化函数式接口匿名内部类
//        Animal a2 = () -> {
//                System.out.println("狗跑的真快！！！");
//        };
//        a2.run();


        Swimming s= new Swimming() {
            @Override
            public void swim() {
                System.out.println("学生快乐的游泳");
            }
        };
        s.swim();

        Swimming s2= () ->{

                System.out.println("老师快乐的游泳");

        };
        s2.swim();



    }
}

interface Swimming{
    void swim();
}


abstract class Animal{
    public abstract void run();
}
